<template>
  <div class="divBox">
    <el-card class="box-card">
      <div slot="header">
        <div class="container">
          <div class="demo-input-suffix acea-row">
            <el-form inline size="small" label-width="100px" ref="tableFormRef">
              <el-form-item label="快手ID：" prop="ks_id">
                <el-input v-model="tableForm.ks_id" @keyup.enter.native="getList(1)" placeholder="请输入姓名" class="selWidth">
                    <el-button slot="append" icon="el-icon-search" class="el-button-solt" @click="getList(1)" />
                </el-input>
              </el-form-item>
              <el-form-item label="钰兔快手ID：" prop="ks_id">
                <el-input v-model="tableForm.ks_uid" @keyup.enter.native="getList(1)" placeholder="请输入姓名" class="selWidth">
                    <el-button slot="append" icon="el-icon-search" class="el-button-solt" @click="getList(1)" />
                </el-input>
              </el-form-item>
              <el-form-item label="钰兔微信ID：" prop="uid">
                <el-input v-model="tableForm.uid" @keyup.enter.native="getList(1)" placeholder="请输入姓名" class="selWidth">
                    <el-button slot="append" icon="el-icon-search" class="el-button-solt" @click="getList(1)" />
                </el-input>
              </el-form-item>
              <el-form-item label="手机号：" prop="phone">
                  <el-input v-model="tableForm.phone" type="number" maxlength="11" @keyup.enter.native="getList(1)" placeholder="请输入手机号" class="selWidth">
                  <el-button slot="append" icon="el-icon-search" class="el-button-solt" @click="getList(1)" />
              </el-input>
                </el-form-item>
            </el-form>
          </div>
        </div>
      </div>
      <el-table
        v-loading="listLoading"
        :data="tableData.data"
        style="width: 100%"
        size="small"
      >
        <el-table-column prop="id" label="ID" width="150" />
        <el-table-column prop="ks_id" label="快手ID" width="200" />
        <el-table-column prop="ks_uid" label="钰兔云快手ID" width="250" />
        <el-table-column prop="uid" label="钰兔云微信ID" min-width="250" />
        <el-table-column prop="phone" label="手机号" min-width="200" />
        <el-table-column fixed="right" width="150">
          <template slot-scope="scope">  
            <el-button type="text" size="small"  style="color: red;" @click="deleteItem(scope.row)">合并</el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="block">
        <el-pagination
          :page-sizes="[20, 40, 60, 80]"
          :page-size="tableForm.limit"
          :current-page="tableForm.page"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.total"
          @size-change="handleSizeChange"
          @current-change="pageChange"
        />
      </div>
    </el-card>
  </div>
</template>

<script>
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import { bindingList  } from '@/api/phone.js'
export default {
    name:'Binding',
    data() {
        return {
        tableData: {
            data: [],
            total: 0,
        },
        tableForm: {
          page: 1,
          limit: 20,
          ks_id: "",
          phone: "",
          ks_uid: "",
          uid:'',
        },
        listLoading: false,
        };
    },
    mounted() {
        this.getList('');
    },
    methods: {  
        // 列表
        async getList(num) {
            this.tableForm.page = num ? num: 1 
            bindingList(this.tableForm).then((res) => { 
                this.tableData.data = res.data.list
                this.tableData.total = res.data.count
            }).catch((err) => { 
                console.log(err)
            })
        },
        pageChange(page) {
            this.tableForm.page = page;
            this.getList('');
        },
        handleSizeChange(val) {
            this.tableForm.limit = val;
            this.getList('');
        }
    }
}
</script>

<style scoped lang="scss">
</style>
